import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
	private static boolean determineAll(boolean[][] mates) {
		for(int i = 0; i < mates.length; i++) {
			for(int j = 0; j < mates[i].length; j++) {
				if(!mates[i][j])
					return false;
			}
		}
		return true;
	}
	private static void shareCandy(boolean[][] mates, int cn, int cm, int n, int m) {
		mates[cn][cm] = true;
		
		int ncn = cn - 1;
		if(ncn >= 0)
			mates[ncn][cm] = true;
		int scn = cn + 1;
		if(scn < n)
			mates[scn][cm] = true;
		int wcm = cm - 1;
		if(wcm >= 0)
			mates[cn][wcm] = true;
		int ecm = cm + 1;
		if(ecm < m)
			mates[cn][ecm] = true;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input;
		String output;
		String[] spInput;
		int n, m, cl, cn, cm;
		boolean[][] mates;
		
		while((input = br.readLine()) != null) {
			int cases = Integer.parseInt(input);
			for(int c = 0; c < cases; c++) {
				input = br.readLine();
				spInput = input.split(" ");
				n = Integer.parseInt(spInput[0]);
				m = Integer.parseInt(spInput[1]);
				cl = Integer.parseInt(spInput[2]);
				
				mates = new boolean[n][m];
				
				for(int i = 0; i < cl; i++) {
					input = br.readLine();
					spInput = input.split(" ");
					cn = Integer.parseInt(spInput[0]) - 1;
					cm = Integer.parseInt(spInput[1]) - 1;
					shareCandy(mates, cn, cm, n, m);
				}
				
				output = "N";
				if(determineAll(mates))
					output = "Y";
				
				System.out.println(output);
			}
		}
	}
}